<?php
$roles=array(
    '1'=>'学生',
    '3'=>'老师',
    '4'=>'内审'
);
$submit=array(
	'name'=>'submit',
	'class'=>'submit',
	'type'=>'submit',
	'value'=>'查询',
);
$delete = array(
    'name'=>'delete',
    'class' => 'submit',
    'value' => 'Delete'

);
$setrole_au = array(
    'name'=>'setrole_au',
    'class' => 'submit',
    'value' => '设为内审'
);
$setrole_tc = array(
    'name'=>'setrole_tc',
    'class' => 'submit',
    'value' => '设为老师'
);
$reset_pass = array(
    'name'=>'reset_pass',
    'class' => 'submit',
    'value' => '重置密码'
)
?>
<head>
    <?php $this->load->view('load_view'); ?>
</head>
<div class="col-wrap handin-wrap">
    <!--start col-->
    <div class="col handin">
        <div class="wrap-title">
            <p class="page-title">
                用户管理
            </p>
        </div>

        <p class="desc">
    	介绍：添加用户，或班级，对用户进行管理
        </p>
        <div class="itemtitle">
            <h3>操作类型</h3>
            <?php $this->load->view('admin/useroptions'); ?>
            <div class="clear"></div>
        </div>
        <div class="search">
            <?php
                echo form_open($this->uri->uri_string());
                echo form_label('搜索用户组');
                echo form_dropdown('roles',$roles);
                echo form_input($submit);
                echo form_close();
                //echo $delete_message;
            ?>
        </div>
            <?php
            $tmpl = array (
                'table_open'          => '<table class="sortTable" id="sortTable" cellspacing="1">',
                'heading_row_start'   => '<thead><tr>',
                'heading_row_end'     => '</tr></thead>',
                'heading_cell_start'  => '<th class="header"><p>',
                'heading_cell_end'    => '</p></th>',
                'table_close'         => '</table>'
            );

            $this->table->set_template($tmpl);
            $this->table->set_heading('是否删除','姓名','Email','最后登录时间','编辑用户');
            echo form_open($this->uri->uri_string());
            foreach ($users as $user)
		{
                        $checkbox=array(
                            'name'=>'checkbox_'.$user->id,
                            'value'=> $user->id,
                            'class'=>'checkbox'
                        );
			$this->table->add_row(
				form_checkbox($checkbox),
				$user->username,
				$user->email,
//				$user->role_name,
//				$banned,
//				$user->last_ip,
				date('Y-m-d', strtotime($user->last_login))
                                //anchor('news/local/123', '设为内审').'&nbsp;'.anchor('news/local/123', '取消内审').'<br />'.anchor('news/local/123', '取消内审').'&nbsp;'.anchor('news/local/123', '取消内审')

//				date('Y-m-d', strtotime($user->created))
                            );
		}

            echo $this->table->generate();
            ?>
            <p class="control">
                <a id="selectAll" href="javascript:">全选</a>
                <a id="selectNone" href="javascript:">不选</a>
                <?  
                    
                    echo form_submit($delete);
                    echo form_submit($setrole_au);
                    echo form_submit($setrole_tc);
                    echo form_submit($reset_pass);
                    echo form_close();
                 ?>
                
            </p>
    </div>
    <!--end col-->
</div>
<!--end col-wrap-->
<script>
    $('ul.selectNav li#manageuser').addClass('current');
    $(window.parent.document).find("ul.nav li a").removeClass("then");
    $(window.parent.document).find("a#usermanage").attr("class","then");
</script>
